// pages/play3/play3.js
const app = getApp()
Page({
  /**
   * 页面的初始数据
   */
  data: {
    paintings:"https://api.52h5.xyz:3001/pContent/?pId=1",
    colorarr:['grey','grey','grey','grey','grey','grey','grey']
    // B598A1
  },
  painting1:function(){
    var temp=this.data.colorarr;
    for(var i=0;i<=6;i++){
      temp[i]='grey';
      if(i == 0){
        temp[i] = '#B598A1'
      }
    }
        this.setData({
          paintings:"https://api.52h5.xyz:3001/pContent/?pId=1",
          pId:1,
          colorarr:temp,
        })
  },
  painting2:function(){
    var temp=this.data.colorarr;
    for(var i=0;i<=6;i++){
      temp[i]='grey';
      if(i == 1){
        temp[i] = '#B598A1'
      }
    }
    this.setData({
      paintings:"https://api.52h5.xyz:3001/pContent/?pId=2",
      pId:2,
      colorarr:temp,
    })
  },
  painting3:function(){
    var temp=this.data.colorarr;
    for(var i=0;i<=6;i++){
      temp[i]='grey';
      if(i == 2){
        temp[i] = '#B598A1'
      }
    }
    this.setData({
      paintings:"https://api.52h5.xyz:3001/pContent/?pId=3",
      pId:3,
      colorarr:temp,
    })
  },
  painting4:function(){
    var temp=this.data.colorarr;
    for(var i=0;i<=6;i++){
      temp[i]='grey';
      if(i == 3){
        temp[i] = '#B598A1'
      }
    }
    this.setData({
      paintings:"https://api.52h5.xyz:3001/pContent/?pId=4",
      pId:4,
      colorarr:temp,
    })
  },
  painting5:function(){
    var temp=this.data.colorarr;
    for(var i=0;i<=6;i++){
      temp[i]='grey';
      if(i == 4){
        temp[i] = '#B598A1'
      }
    }
    this.setData({
      paintings:"https://api.52h5.xyz:3001/pContent/?pId=5",
      pId:5,
      colorarr:temp,
    })
  },
  painting6:function(){
    var temp=this.data.colorarr;
    for(var i=0;i<=6;i++){
      temp[i]='grey';
      if(i == 5){
        temp[i] = '#B598A1'
      }
    }
    this.setData({
      paintings:"https://api.52h5.xyz:3001/pContent/?pId=6",
      pId:6,
      colorarr:temp,
    })
  },
  painting7:function(){
    var temp=this.data.colorarr;
    for(var i=0;i<=6;i++){
      temp[i]='grey';
      if(i == 6){
        temp[i] = '#B598A1'
      }
    }
    this.setData({
      paintings:"https://api.52h5.xyz:3001/pContent/?pId=7",
      pId:7,
      colorarr:temp,
    })
  },
  
  goToPlay4:function(){
    var pId=this.data.pId
    wx.navigateTo({
      url: `/pages/play4/play4?pId=${pId}`,
    })
    
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    // wx.request({
    //   url: `${app.globalData.url}/pInformation/?pId=1`,
    //   success: res=>{
    //     this.setData({
    //       paint: {
    //         imgsrc: "https://api.52h5.xyz:3001/pContent?pId=1",
    //         text: res.data.data[0].pInformation
    //       }
    //     })
    //   }
    // })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})